# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pangomm
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.42.1
pkgrel=1
pkgdesc="C++ bindings for pango (mingw-w64)"
arch=('any')
url="https://gtkmm.sourceforge.io/"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-cairomm" "${MINGW_PACKAGE_PREFIX}-glibmm" "${MINGW_PACKAGE_PREFIX}-pango")
options=(staticlibs strip)
source=("https://download.gnome.org/sources/pangomm/${pkgver%.*}/${_realname}-${pkgver}.tar.xz")
sha256sums=('14bf04939930870d5cfa96860ed953ad2ce07c3fd8713add4a1bfe585589f40f')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  sed -i -e "s,AC_DISABLE_STATIC,AC_DISABLE_STATIC\nlt_cv_deplibs_check_method='pass_all'," configure.ac
  autoconf --force
}

build() {
  CPPFLAGS+=" -D_REENTRANT"
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static \
    --disable-documentation

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
